package com.fita.scheduler.entity;

import com.fita.entity.wallet.DistributionRewardRecordStatus;

import javax.persistence.Column;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import java.util.Date;

/**
 * @description:
 * @author: 11200
 * @date: 2019/8/1
 */
public class DistributionRewardRecord {

    private Long id;

    /**
     * 一级代理提成率
     */
    private Integer rate;

    /**
     * 奖励金额(分)
     */
    private Integer amount;

    /**
     * 当前余额（分）
     */
    private Integer currentUserWalletAmount;

    private Date createTime;

    @Enumerated(EnumType.STRING)
    private DistributionRewardRecordStatus status;

    /**
     * 目标钱包
     */
    private Long targetUserWalletId;


    @Column(name = "is_disabled")
    private Boolean disabled;


    /**
     * 核销
     * @return
     */
    public DistributionRewardRecord consume(Integer currentUserWalletAmount) {

        this.status = DistributionRewardRecordStatus.CONSUMED;

        this.currentUserWalletAmount = currentUserWalletAmount;

        return this;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Integer getRate() {
        return rate;
    }

    public void setRate(Integer rate) {
        this.rate = rate;
    }

    public Integer getAmount() {
        return amount;
    }

    public void setAmount(Integer amount) {
        this.amount = amount;
    }

    public Integer getCurrentUserWalletAmount() {
        return currentUserWalletAmount;
    }

    public void setCurrentUserWalletAmount(Integer currentUserWalletAmount) {
        this.currentUserWalletAmount = currentUserWalletAmount;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public DistributionRewardRecordStatus getStatus() {
        return status;
    }

    public void setStatus(DistributionRewardRecordStatus status) {
        this.status = status;
    }

    public Boolean getDisabled() {
        return disabled;
    }

    public void setDisabled(Boolean disabled) {
        this.disabled = disabled;
    }

    public Long getTargetUserWalletId() {
        return targetUserWalletId;
    }

    public void setTargetUserWalletId(Long targetUserWalletId) {
        this.targetUserWalletId = targetUserWalletId;
    }
}
